#include "ftbasicwidget.h"

FTBasicWidget::FTBasicWidget(QWidget *parent) :
    QWidget(parent)
{
    setBackgroundRole( QPalette::Window );
    setContextMenuPolicy(Qt::NoContextMenu);
    _backgroundStyle = Qt::NoBrush;
    _orientation = FTControls::not_oriented;
}

void FTBasicWidget::setBackgroundStyle(Qt::BrushStyle bs)
{
    _backgroundStyle = bs;
}

Qt::BrushStyle FTBasicWidget::backgroundStyle() const
{
    return _backgroundStyle;
}

void FTBasicWidget::setOrientation(FTControls::Orientation new_or)
{
    if ( _orientation != new_or )
    {
        if ( _orientation != FTControls::not_oriented )
        {
            QSizePolicy::Policy verticalPolicy = sizePolicy().verticalPolicy();
            QSizePolicy::Policy horizontalPolicy = sizePolicy().horizontalPolicy();
            // Invert size policy...
            setSizePolicy( verticalPolicy, horizontalPolicy );
        }
        _orientation = new_or;
        update();
    }
}

FTControls::Orientation FTBasicWidget::orientation() const
{
    return _orientation;
}
